package org.example;

import org.example.bootstrap.ConsumerBootstrap;
import org.example.model.User;
import org.example.proxy.ServiceProxyFactory;
import org.example.service.UserService;

public class EasyConsumerExample {
    public static void main(String[] args) {
        Thread.currentThread().setName("消费者");

        //服务提供者初始化
        ConsumerBootstrap.init();
        // 需要获取UserService的实现类对象
        UserService service = ServiceProxyFactory.getProxy(UserService.class);
        User user = new User();
        user.setName("ikun");
        //调用
        User newUser = service.getUser(user);
        if (newUser != null){
            System.out.println(newUser.getName());
        }else {
            System.out.println("user == null");
        }
    }
}
